<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Rails::Initializer</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Rails::Initializer</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/railties/lib/initializer_rb.html">
                vendor/rails/railties/lib/initializer.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
The <a href="Initializer.html">Initializer</a> is responsible for
processing the <a href="../Rails.html">Rails</a> configuration, such as
setting the $LOAD_PATH, requiring the right frameworks, initializing
logging, and more. It can be <a href="Initializer.html#M001571">run</a>
either as a single command that&#8216;ll just use the default
configuration, like this:
</p>
<pre>
  Rails::Initializer.run
</pre>
<p>
But normally it&#8216;s more interesting to pass in a custom configuration
through the block running:
</p>
<pre>
  Rails::Initializer.run do |config|
    config.frameworks -= [ :action_mailer ]
  end
</pre>
<p>
This will use the default configuration options from <a
href="Configuration.html">Rails::Configuration</a>, but allow for
overwriting on select areas.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001579">add_plugin_load_paths</a>&nbsp;&nbsp;
      <a href="#M001578">add_support_load_paths</a>&nbsp;&nbsp;
      <a href="#M001594">after_initialize</a>&nbsp;&nbsp;
      <a href="#M001574">check_ruby_version</a>&nbsp;&nbsp;
      <a href="#M001585">initialize_database</a>&nbsp;&nbsp;
      <a href="#M001590">initialize_dependency_mechanism</a>&nbsp;&nbsp;
      <a href="#M001584">initialize_encoding</a>&nbsp;&nbsp;
      <a href="#M001587">initialize_framework_logging</a>&nbsp;&nbsp;
      <a href="#M001593">initialize_framework_settings</a>&nbsp;&nbsp;
      <a href="#M001588">initialize_framework_views</a>&nbsp;&nbsp;
      <a href="#M001586">initialize_logger</a>&nbsp;&nbsp;
      <a href="#M001589">initialize_routing</a>&nbsp;&nbsp;
      <a href="#M001592">initialize_temporary_directories</a>&nbsp;&nbsp;
      <a href="#M001591">initialize_whiny_nils</a>&nbsp;&nbsp;
      <a href="#M001595">load_application_initializers</a>&nbsp;&nbsp;
      <a href="#M001582">load_environment</a>&nbsp;&nbsp;
      <a href="#M001583">load_observers</a>&nbsp;&nbsp;
      <a href="#M001580">load_plugins</a>&nbsp;&nbsp;
      <a href="#M001572">new</a>&nbsp;&nbsp;
      <a href="#M001581">plugin_loader</a>&nbsp;&nbsp;
      <a href="#M001573">process</a>&nbsp;&nbsp;
      <a href="#M001577">require_frameworks</a>&nbsp;&nbsp;
      <a href="#M001571">run</a>&nbsp;&nbsp;
      <a href="#M001576">set_autoload_paths</a>&nbsp;&nbsp;
      <a href="#M001575">set_load_path</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">configuration</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc">
The <a href="Configuration.html">Configuration</a> instance used by this <a
href="Initializer.html">Initializer</a> instance.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">loaded_plugins</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc">
The set of loaded plugins.

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001572" class="method-detail">
        <a name="M001572"></a>

        <div class="method-heading">
          <a href="#M001572" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(configuration)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a <a href="Initializer.html#M001572">new</a> <a
href="Initializer.html">Initializer</a> instance that references the given
<a href="Configuration.html">Configuration</a> instance.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001572-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001572-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 55</span>
55:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">configuration</span>)
56:       <span class="ruby-ivar">@configuration</span> = <span class="ruby-identifier">configuration</span>
57:       <span class="ruby-ivar">@loaded_plugins</span> = []
58:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001571" class="method-detail">
        <a name="M001571"></a>

        <div class="method-heading">
          <a href="#M001571" class="method-signature">
          <span class="method-name">run</span><span class="method-args">(command = :process, configuration = Configuration.new) {|configuration if block_given?| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Runs the initializer. By default, this will invoke the <a
href="Initializer.html#M001573">process</a> method, which simply executes
all of the initialization routines. Alternately, you can specify explicitly
which initialization routine you want:
</p>
<pre>
  Rails::Initializer.run(:set_load_path)
</pre>
<p>
This is useful if you only want the load path initialized, without incuring
the overhead of completely loading the entire environment.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001571-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001571-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 46</span>
46:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">command</span> = <span class="ruby-identifier">:process</span>, <span class="ruby-identifier">configuration</span> = <span class="ruby-constant">Configuration</span>.<span class="ruby-identifier">new</span>)
47:       <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">configuration</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
48:       <span class="ruby-identifier">initializer</span> = <span class="ruby-identifier">new</span> <span class="ruby-identifier">configuration</span>
49:       <span class="ruby-identifier">initializer</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">command</span>)
50:       <span class="ruby-identifier">initializer</span>
51:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001579" class="method-detail">
        <a name="M001579"></a>

        <div class="method-heading">
          <a href="#M001579" class="method-signature">
          <span class="method-name">add_plugin_load_paths</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds all load paths from plugins to the global set of load paths, so that
code from plugins can be required (explicitly or automatically via
Dependencies).
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001579-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001579-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 169</span>
169:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_plugin_load_paths</span>
170:       <span class="ruby-identifier">plugin_loader</span>.<span class="ruby-identifier">add_plugin_load_paths</span>
171:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001578" class="method-detail">
        <a name="M001578"></a>

        <div class="method-heading">
          <a href="#M001578" class="method-signature">
          <span class="method-name">add_support_load_paths</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Add the load paths used by support functions such as the info controller
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001578-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001578-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 164</span>
164:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_support_load_paths</span>
165:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001594" class="method-detail">
        <a name="M001594"></a>

        <div class="method-heading">
          <a href="#M001594" class="method-signature">
          <span class="method-name">after_initialize</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Fires the user-supplied <a
href="Initializer.html#M001594">after_initialize</a> block (<a
href="Configuration.html#M001611">Configuration#after_initialize</a>)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001594-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001594-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 335</span>
335:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_initialize</span>
336:       <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">after_initialize_blocks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">block</span><span class="ruby-operator">|</span>
337:         <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
338:       <span class="ruby-keyword kw">end</span>
339:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001574" class="method-detail">
        <a name="M001574"></a>

        <div class="method-heading">
          <a href="#M001574" class="method-signature">
          <span class="method-name">check_ruby_version</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Check for valid Ruby version This is done in an external file, so we can
use it from the `rails` program as well without duplication.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001574-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001574-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 122</span>
122:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_ruby_version</span>
123:       <span class="ruby-identifier">require</span> <span class="ruby-value str">'ruby_version_check'</span>
124:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001585" class="method-detail">
        <a name="M001585"></a>

        <div class="method-heading">
          <a href="#M001585" class="method-signature">
          <span class="method-name">initialize_database</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This initialization routine does nothing unless <tt>:active_record</tt> is
one of the frameworks to load (Configuration#frameworks). If it is, this
sets the database configuration from <a
href="Configuration.html#M001608">Configuration#database_configuration</a>
and then establishes the connection.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001585-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001585-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 232</span>
232:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_database</span>
233:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:active_record</span>)
234:         <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">configurations</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">database_configuration</span>
235:         <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>
236:       <span class="ruby-keyword kw">end</span>
237:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001590" class="method-detail">
        <a name="M001590"></a>

        <div class="method-heading">
          <a href="#M001590" class="method-signature">
          <span class="method-name">initialize_dependency_mechanism</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the dependency loading mechanism based on the value of
Configuration#cache_classes.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001590-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001590-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 299</span>
299:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_dependency_mechanism</span>
300:       <span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">mechanism</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">cache_classes</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">require</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:load</span>
301:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001584" class="method-detail">
        <a name="M001584"></a>

        <div class="method-heading">
          <a href="#M001584" class="method-signature">
          <span class="method-name">initialize_encoding</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This initialization sets $KCODE to &#8216;u&#8217; to enable the multibyte
safe operations. <a href="../Plugin.html">Plugin</a> authors supporting
other encodings should override this behaviour and set the relevant
<tt>default_charset</tt> on <a
href="../ActionController/Base.html">ActionController::Base</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001584-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001584-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 224</span>
224:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_encoding</span>
225:       <span class="ruby-identifier">$KCODE</span>=<span class="ruby-value str">'u'</span>
226:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001587" class="method-detail">
        <a name="M001587"></a>

        <div class="method-heading">
          <a href="#M001587" class="method-signature">
          <span class="method-name">initialize_framework_logging</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the logger for ActiveRecord, ActionController, and ActionMailer (but
only for those frameworks that are to be loaded). If the framework&#8216;s
logger is already set, it is not changed, otherwise it is set to use
<tt>RAILS_DEFAULT_LOGGER</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001587-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001587-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 273</span>
273:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_framework_logging</span>
274:       <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">framework</span> <span class="ruby-keyword kw">in</span> ([ <span class="ruby-identifier">:active_record</span>, <span class="ruby-identifier">:action_controller</span>, <span class="ruby-identifier">:action_mailer</span> ] <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>)
275:         <span class="ruby-identifier">framework</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">camelize</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-value str">&quot;Base&quot;</span>).<span class="ruby-identifier">logger</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>
276:       <span class="ruby-keyword kw">end</span>
277:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001593" class="method-detail">
        <a name="M001593"></a>

        <div class="method-heading">
          <a href="#M001593" class="method-signature">
          <span class="method-name">initialize_framework_settings</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Initializes framework-specific settings for each of the loaded frameworks
(Configuration#frameworks). The available settings map to the accessors on
each of the corresponding Base classes.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001593-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001593-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 324</span>
324:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_framework_settings</span>
325:       <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">framework</span><span class="ruby-operator">|</span>
326:         <span class="ruby-identifier">base_class</span> = <span class="ruby-identifier">framework</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">camelize</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-value str">&quot;Base&quot;</span>)
327: 
328:         <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">framework</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">setting</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
329:           <span class="ruby-identifier">base_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{setting}=&quot;</span>, <span class="ruby-identifier">value</span>)
330:         <span class="ruby-keyword kw">end</span>
331:       <span class="ruby-keyword kw">end</span>
332:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001588" class="method-detail">
        <a name="M001588"></a>

        <div class="method-heading">
          <a href="#M001588" class="method-signature">
          <span class="method-name">initialize_framework_views</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets +ActionController::Base#view_paths+ and
+ActionMailer::Base#template_root+ (but only for those frameworks that are
to be loaded). If the framework&#8216;s paths have already been set, it is
not changed, otherwise it is set to use Configuration#view_path.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001588-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001588-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 283</span>
283:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_framework_views</span>
284:       <span class="ruby-constant">ActionMailer</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">template_root</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">view_path</span>  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:action_mailer</span>)
285:       <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">view_paths</span> = [<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">view_path</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:action_controller</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">view_paths</span>.<span class="ruby-identifier">empty?</span>
286:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001586" class="method-detail">
        <a name="M001586"></a>

        <div class="method-heading">
          <a href="#M001586" class="method-signature">
          <span class="method-name">initialize_logger</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
If the <tt>RAILS_DEFAULT_LOGGER</tt> constant is already set, this
initialization routine does nothing. If the constant is not set, and
Configuration#logger is not <tt>nil</tt>, this also does nothing.
Otherwise, a <a href="Initializer.html#M001572">new</a> logger instance is
created at Configuration#log_path, with a default log level of
Configuration#log_level.
</p>
<p>
If the log could not be created, the log will be set to output to
<tt>STDERR</tt>, with a log level of <tt>WARN</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001586-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001586-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 247</span>
247:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_logger</span>
248:       <span class="ruby-comment cmt"># if the environment has explicitly defined a logger, use it</span>
249:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>)
250: 
251:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">logger</span>
252:         <span class="ruby-keyword kw">begin</span>
253:           <span class="ruby-identifier">logger</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">BufferedLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">log_path</span>)
254:           <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">BufferedLogger</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">log_level</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>)
255:           <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">auto_flushing</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">environment</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;production&quot;</span>
256:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span><span class="ruby-identifier">e</span>
257:           <span class="ruby-identifier">logger</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">BufferedLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDERR</span>)
258:           <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">BufferedLogger</span><span class="ruby-operator">::</span><span class="ruby-constant">WARN</span>
259:           <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(
260:             <span class="ruby-node">&quot;Rails Error: Unable to access log file. Please ensure that #{configuration.log_path} exists and is chmod 0666. &quot;</span> <span class="ruby-operator">+</span>
261:             <span class="ruby-value str">&quot;The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.&quot;</span>
262:           )
263:         <span class="ruby-keyword kw">end</span>
264:       <span class="ruby-keyword kw">end</span>
265: 
266:       <span class="ruby-identifier">silence_warnings</span> { <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span> <span class="ruby-value str">&quot;RAILS_DEFAULT_LOGGER&quot;</span>, <span class="ruby-identifier">logger</span> }
267:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001589" class="method-detail">
        <a name="M001589"></a>

        <div class="method-heading">
          <a href="#M001589" class="method-signature">
          <span class="method-name">initialize_routing</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
If ActionController is not one of the loaded frameworks
(Configuration#frameworks) this does nothing. Otherwise, it loads the
routing definitions and sets up loading module used to lazily load
controllers (Configuration#controller_paths).
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001589-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001589-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 291</span>
291:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_routing</span>
292:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:action_controller</span>)
293:       <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Routing</span>.<span class="ruby-identifier">controller_paths</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">controller_paths</span>
294:       <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Routing</span><span class="ruby-operator">::</span><span class="ruby-constant">Routes</span>.<span class="ruby-identifier">reload</span>
295:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001592" class="method-detail">
        <a name="M001592"></a>

        <div class="method-heading">
          <a href="#M001592" class="method-signature">
          <span class="method-name">initialize_temporary_directories</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001592-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001592-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 309</span>
309:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_temporary_directories</span>
310:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:action_controller</span>)
311:         <span class="ruby-identifier">session_path</span> = <span class="ruby-node">&quot;#{configuration.root_path}/tmp/sessions/&quot;</span>
312:         <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">session_options</span>[<span class="ruby-identifier">:tmpdir</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">session_path</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">session_path</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmpdir</span>
313: 
314:         <span class="ruby-identifier">cache_path</span> = <span class="ruby-node">&quot;#{configuration.root_path}/tmp/cache/&quot;</span>
315:         <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">cache_path</span>)
316:           <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">fragment_cache_store</span> = <span class="ruby-identifier">:file_store</span>, <span class="ruby-identifier">cache_path</span>
317:         <span class="ruby-keyword kw">end</span>
318:       <span class="ruby-keyword kw">end</span>
319:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001591" class="method-detail">
        <a name="M001591"></a>

        <div class="method-heading">
          <a href="#M001591" class="method-signature">
          <span class="method-name">initialize_whiny_nils</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Loads support for &quot;whiny nil&quot; (noisy warnings when methods are
invoked on <tt>nil</tt> values) if Configuration#whiny_nils is true.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001591-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001591-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 305</span>
305:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_whiny_nils</span>
306:       <span class="ruby-identifier">require</span>(<span class="ruby-value str">'active_support/whiny_nil'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">whiny_nils</span>
307:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001595" class="method-detail">
        <a name="M001595"></a>

        <div class="method-heading">
          <a href="#M001595" class="method-signature">
          <span class="method-name">load_application_initializers</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001595-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001595-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 341</span>
341:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_application_initializers</span>
342:       <span class="ruby-constant">Dir</span>[<span class="ruby-node">&quot;#{configuration.root_path}/config/initializers/**/*.rb&quot;</span>].<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">initializer</span><span class="ruby-operator">|</span>
343:         <span class="ruby-identifier">load</span>(<span class="ruby-identifier">initializer</span>)
344:       <span class="ruby-keyword kw">end</span>
345:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001582" class="method-detail">
        <a name="M001582"></a>

        <div class="method-heading">
          <a href="#M001582" class="method-signature">
          <span class="method-name">load_environment</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Loads the environment specified by <a
href="Configuration.html#M001609">Configuration#environment_path</a>, which
is typically one of development, test, or production.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001582-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001582-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 199</span>
199:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_environment</span>
200:       <span class="ruby-identifier">silence_warnings</span> <span class="ruby-keyword kw">do</span>
201:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@environment_loaded</span>
202:         <span class="ruby-ivar">@environment_loaded</span> = <span class="ruby-keyword kw">true</span>
203:         
204:         <span class="ruby-identifier">config</span> = <span class="ruby-identifier">configuration</span>
205:         <span class="ruby-identifier">constants</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">constants</span>
206:         
207:         <span class="ruby-identifier">eval</span>(<span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">environment_path</span>), <span class="ruby-identifier">binding</span>, <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">environment_path</span>)
208:         
209:         (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">constants</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">constants</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">const</span><span class="ruby-operator">|</span>
210:           <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">const</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">const</span>))
211:         <span class="ruby-keyword kw">end</span>
212:       <span class="ruby-keyword kw">end</span>
213:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001583" class="method-detail">
        <a name="M001583"></a>

        <div class="method-heading">
          <a href="#M001583" class="method-signature">
          <span class="method-name">load_observers</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001583-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001583-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 215</span>
215:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_observers</span>
216:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:active_record</span>)
217:         <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">instantiate_observers</span>
218:       <span class="ruby-keyword kw">end</span>
219:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001580" class="method-detail">
        <a name="M001580"></a>

        <div class="method-heading">
          <a href="#M001580" class="method-signature">
          <span class="method-name">load_plugins</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Loads all plugins in <tt>config.plugin_paths</tt>. <tt>plugin_paths</tt>
defaults to <tt>vendor/plugins</tt> but may also be set to a list of paths,
such as
</p>
<pre>
  config.plugin_paths = [&quot;#{RAILS_ROOT}/lib/plugins&quot;, &quot;#{RAILS_ROOT}/vendor/plugins&quot;]
</pre>
<p>
In the default implementation, as each plugin discovered in
<tt>plugin_paths</tt> is initialized:
</p>
<ul>
<li>its <tt>lib</tt> directory, if present, is added to the load path
(immediately after the applications lib directory)

</li>
<li><tt>init.rb</tt> is evaluated, if present

</li>
</ul>
<p>
After all plugins are loaded, duplicates are removed from the load path. If
an array of plugin names is specified in config.plugins, only those plugins
will be loaded and they plugins will be loaded in that order. Otherwise,
plugins are loaded in alphabetical order.
</p>
<p>
if config.plugins ends contains :all then the named plugins will be loaded
in the given order and all other plugins will be loaded in alphabetical
order
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001580-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001580-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 189</span>
189:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_plugins</span>
190:       <span class="ruby-identifier">plugin_loader</span>.<span class="ruby-identifier">load_plugins</span>
191:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001581" class="method-detail">
        <a name="M001581"></a>

        <div class="method-heading">
          <a href="#M001581" class="method-signature">
          <span class="method-name">plugin_loader</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001581-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001581-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 193</span>
193:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plugin_loader</span>
194:       <span class="ruby-ivar">@plugin_loader</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">plugin_loader</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
195:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001573" class="method-detail">
        <a name="M001573"></a>

        <div class="method-heading">
          <a href="#M001573" class="method-signature">
          <span class="method-name">process</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sequentially step through all of the available initialization routines, in
order:
</p>
<ul>
<li><a href="Initializer.html#M001574">check_ruby_version</a>

</li>
<li><a href="Initializer.html#M001575">set_load_path</a>

</li>
<li><a href="Initializer.html#M001577">require_frameworks</a>

</li>
<li><a href="Initializer.html#M001576">set_autoload_paths</a>

</li>
<li><a href="Initializer.html#M001579">add_plugin_load_paths</a>

</li>
<li><a href="Initializer.html#M001582">load_environment</a>

</li>
<li><a href="Initializer.html#M001584">initialize_encoding</a>

</li>
<li><a href="Initializer.html#M001585">initialize_database</a>

</li>
<li><a href="Initializer.html#M001586">initialize_logger</a>

</li>
<li><a href="Initializer.html#M001587">initialize_framework_logging</a>

</li>
<li><a href="Initializer.html#M001588">initialize_framework_views</a>

</li>
<li><a href="Initializer.html#M001590">initialize_dependency_mechanism</a>

</li>
<li><a href="Initializer.html#M001591">initialize_whiny_nils</a>

</li>
<li><a href="Initializer.html#M001592">initialize_temporary_directories</a>

</li>
<li><a href="Initializer.html#M001593">initialize_framework_settings</a>

</li>
<li><a href="Initializer.html#M001578">add_support_load_paths</a>

</li>
<li><a href="Initializer.html#M001580">load_plugins</a>

</li>
<li><a href="Initializer.html#M001583">load_observers</a>

</li>
<li><a href="Initializer.html#M001589">initialize_routing</a>

</li>
<li><a href="Initializer.html#M001594">after_initialize</a>

</li>
<li><a href="Initializer.html#M001595">load_application_initializers</a>

</li>
</ul>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001573-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001573-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 84</span>
 84:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>
 85:       <span class="ruby-identifier">check_ruby_version</span>
 86:       <span class="ruby-identifier">set_load_path</span>
 87:       
 88:       <span class="ruby-identifier">require_frameworks</span>
 89:       <span class="ruby-identifier">set_autoload_paths</span>
 90:       <span class="ruby-identifier">add_plugin_load_paths</span>
 91:       <span class="ruby-identifier">load_environment</span>
 92: 
 93:       <span class="ruby-identifier">initialize_encoding</span>
 94:       <span class="ruby-identifier">initialize_database</span>
 95:       <span class="ruby-identifier">initialize_logger</span>
 96:       <span class="ruby-identifier">initialize_framework_logging</span>
 97:       <span class="ruby-identifier">initialize_framework_views</span>
 98:       <span class="ruby-identifier">initialize_dependency_mechanism</span>
 99:       <span class="ruby-identifier">initialize_whiny_nils</span>
100:       <span class="ruby-identifier">initialize_temporary_directories</span>
101:       <span class="ruby-identifier">initialize_framework_settings</span>
102: 
103:       <span class="ruby-identifier">add_support_load_paths</span>
104: 
105:       <span class="ruby-identifier">load_plugins</span>
106: 
107:       <span class="ruby-comment cmt"># Observers are loaded after plugins in case Observers or observed models are modified by plugins.</span>
108:       <span class="ruby-identifier">load_observers</span>
109: 
110:       <span class="ruby-comment cmt"># Routing must be initialized after plugins to allow the former to extend the routes</span>
111:       <span class="ruby-identifier">initialize_routing</span>
112: 
113:       <span class="ruby-comment cmt"># the framework is now fully initialized</span>
114:       <span class="ruby-identifier">after_initialize</span>
115: 
116:       <span class="ruby-identifier">load_application_initializers</span>
117:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001577" class="method-detail">
        <a name="M001577"></a>

        <div class="method-heading">
          <a href="#M001577" class="method-signature">
          <span class="method-name">require_frameworks</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Requires all frameworks specified by the Configuration#frameworks list. By
default, all frameworks (ActiveRecord, ActiveSupport, ActionPack,
ActionMailer, and <a href="../ActiveResource.html">ActiveResource</a>) are
loaded.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001577-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001577-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 156</span>
156:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">require_frameworks</span>
157:       <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">frameworks</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">framework</span><span class="ruby-operator">|</span> <span class="ruby-identifier">require</span>(<span class="ruby-identifier">framework</span>.<span class="ruby-identifier">to_s</span>) }
158:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
159:       <span class="ruby-comment cmt"># re-raise because Mongrel would swallow it</span>
160:       <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>
161:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001576" class="method-detail">
        <a name="M001576"></a>

        <div class="method-heading">
          <a href="#M001576" class="method-signature">
          <span class="method-name">set_autoload_paths</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Set the paths from which <a href="../Rails.html">Rails</a> will
automatically load source files, and the load_once paths.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001576-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001576-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 136</span>
136:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_autoload_paths</span>
137:       <span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">load_paths</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">load_paths</span>.<span class="ruby-identifier">uniq</span>
138:       <span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">load_once_paths</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">load_once_paths</span>.<span class="ruby-identifier">uniq</span>
139: 
140:       <span class="ruby-identifier">extra</span> = <span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">load_once_paths</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">load_paths</span>
141:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">extra</span>.<span class="ruby-identifier">empty?</span>
142:         <span class="ruby-identifier">abort</span> <span class="ruby-value str">&quot;load_once_paths must be a subset of the load_paths.\nExtra items in load_once_paths: \#{extra * ','}\n&quot;</span>
143:       <span class="ruby-keyword kw">end</span>
144: 
145:       <span class="ruby-comment cmt"># Freeze the arrays so future modifications will fail rather than do nothing mysteriously</span>
146:       <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">load_once_paths</span>.<span class="ruby-identifier">freeze</span>
147:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001575" class="method-detail">
        <a name="M001575"></a>

        <div class="method-heading">
          <a href="#M001575" class="method-signature">
          <span class="method-name">set_load_path</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Set the <tt>$LOAD_PATH</tt> based on the value of Configuration#load_paths.
Duplicates are removed.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001575-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001575-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/initializer.rb, line 128</span>
128:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_load_path</span>
129:       <span class="ruby-identifier">load_paths</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">load_paths</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">framework_paths</span>
130:       <span class="ruby-identifier">load_paths</span>.<span class="ruby-identifier">reverse_each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">dir</span><span class="ruby-operator">|</span> <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">dir</span>) }
131:       <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">uniq!</span>
132:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>